# Contributor: David Demelier <markand@malikania.fr>
# Maintainer: David Demelier <markand@malikania.fr>
pkgname=wesnoth
pkgver=1.14.11
_major=${pkgver%.*}
pkgrel=0
pkgdesc="turn-based strategy game in fantasy world"
url="https://www.wesnoth.org"
arch="all !mips !mips64" # fails to build on mips
license="GPL-2.0-only"
makedepends="boost-dev bzip2-dev cairo-dev cmake dbus-dev fontconfig-dev
	fribidi-dev libvorbis-dev openssl-dev pango-dev sdl2-dev
	sdl2_image-dev sdl2_mixer-dev sdl2_ttf-dev zlib-dev"
subpackages="$pkgname-doc"
source="https://sourceforge.net/projects/wesnoth/files/wesnoth-$_major/wesnoth-$pkgver/wesnoth-$pkgver.tar.bz2"
options="!check" # No tests

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
		-DCMAKE_C_FLAGS="$CFLAGS" \
		$CMAKE_CROSSOPTS .
	make
}

package() {
	make DESTDIR="$pkgdir" install
}

sha512sums="f0c932a2623df35bdcae3d758f3c9ef583ab04bb886408d75b2fe3ee9600af0f55764448782d64561a44150b4628d6340050425d15fc140984e23d5c40769c66  wesnoth-1.14.11.tar.bz2"
